$(function(){
			var productId = sessionStorage['productId'];
			Newtouch.Ajax.sendParams({productId:productId},localStorage['APP_AJAX_PATH']+"/drinkingBar/view/productDetail.jsp.findProductByProductId",function(data){
				$("#productId").val(data.id);
				$("#productName").append(data.name);
				$("#price").append(data.price);
				$("#nutrition").append(data.nutrition);
				$("#description").append(data.description);
				androidLocal({"productName":data.name});
				androidLocal({"productPrice":data.price});
				androidLocal({"productImage":data.image});
				$("#image").append('<img src="'+data.image+'" class="img-polaroid"/>');
			});
	      $("#addToCart").bind("tap",function(){
	    	  	var userName = sessionStorage['username'];
	    		if(userName==null||userName==""){
	    			$(window).mobileMsgBox({msgText:"请先登录",delayTime:1000});
	    			window.location="login.html#loginPage";
	    		}else{	
	    			var id = $("#productId").val();
	    	  	   	Newtouch.Ajax.sendParams({productId:id,userId:sessionStorage['userId']},localStorage['APP_AJAX_PATH']+"/drinkingBar/view/productDetail.jsp.addProToCart",function(data){	
	    			$(window).mobileMsgBox({msgText:"添加购物车成功",delayTime:500});
	    		},function(err){
	    			$(window).mobileMsgBox({msgText:"添加购物车失败",delayTime:500});
	    		});
	    		}
	       });
	      $("#buyProduct").bind("tap",function(){
	    	  	var userName = sessionStorage['username'];
	    		if(userName==null||userName==""){
	    			$(window).mobileMsgBox({msgText:"请先登录",delayTime:1000});
	    			window.location="login.html#loginPage";
	    		}else{
	    			window.location="buyProduct.html";
	    		}
	    		});
});
var androidLocal=function(p){
	for(var k in p){
		sessionStorage[k]=p[k];
	}
	
}